#include "WindowInitialiser.h"
#include "DX11Initialiser.h"
#include "SceneInitialiser.h"

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int pShowWindowParam) {
	Window *window = WindowInitialiser::initWindow(hInstance, pShowWindowParam);
	DX11Initialiser *dx11Initialiser = new DX11Initialiser(window);
	dx11Initialiser = dx11Initialiser->setDebugMode(true);
	Optional<DX11Structure> dx11Structure = dx11Initialiser->initDX11();
	if (!dx11Structure.exists()) {
		return -1;
	}
	DataLoader *dataLoader = new DataLoader();
	SceneInitialiser *sceneInitialiser = new SceneInitialiser(dataLoader, dx11Structure.get());
	Optional<SceneStructure> sceneStructure = sceneInitialiser->initScene();
	if (!sceneStructure.exists()) {
		return -1;
	}

	/*DX11Renderer renderer = DX11Renderer(hInstance, nShowCmd, true);
	if (!renderer.initialise()) {
		return -1;
	}
	renderer.loop();
	renderer.releaseObjects();*/

	delete dx11Initialiser;
	delete sceneInitialiser;
	delete dataLoader;
	return 0;
}
